[Android] How to launch an Activity without a UI?

Posted by fjmustak on Stack Overflow See other posts from Stack Overflow or by fjmustak
Published on 2010-04-24T10:23:22Z Indexed on 2010/04/24 10:33 UTC
Read the original article Hit count: 129

Filed under:

Is it in any way possible to launch an activity from the main function without having a UI? i.e. is there a way to create a sort of "wrapper" around another activity, i.e. by launching the main activity, it takes you to another activity automatically.

If that is not possible, is there a way to remove the main activity from the stack so that clicking the back button does not take you to a blank UI? Here's an example of what I'm trying to do:

public class WrapperActivity extends Activity {

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        final Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:555-1212"));
        startActivity(intent);
    }
}

© Stack Overflow or respective owner

Related posts about android